import { request, requestFy } from "@/utils/request";

// 获取运输计划列表
export function getWayBillList(data) {
  return request({
    url: "/queue/waybill/page",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}
// 获取首页车辆统计列表
export function getCarsLists() {
  return request({
    url: "/queue/queue-statistics/count",
    headers: {
      isToken: false,
    },
    method: "GET",
  });
}

export function getSellCount() {
  return request({
    url: "/queue/queue-statistics/getSellCount",
    headers: {
      isToken: false,
    },
    method: "GET",
  });
}

// 运单手动完成
export function finishWayBill(data) {
  return request({
    url: `/queue/waybill/finish?waybillNo=${data}`,
    headers: {
      isToken: false,
    },
    method: "PUT",
    data: data,
  });
}

// 运单作废
export function delWayBill(data) {
  return request({
    url: `/queue/waybill/invalid?waybillNo`,
    headers: {
      isToken: false,
    },
    method: "DELETE",
    data: data,
  });
}

// 获取黑名单列表
export function getBlackList(data) {
  return request({
    url: "/queue/blacklist-config/page",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}

// 修改黑名单
export function updateBlacklist(data) {
  return request({
    url: `/queue/blacklist-config/update`,
    headers: {
      isToken: false,
    },
    method: "PUT",
    data: data,
  });
}

// 获取违规信息列表
export function getVialationList(data) {
  return request({
    url: "/queue/violation-info-mgr/page",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}

// 获取违规信息列表
export function getVialationInfo(data) {
  return request({
    url: "/queue/violation-info-mgr/get",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}

// 更新违规
export function updateVialation(data) {
  return request({
    url: `/queue/violation-info-mgr/update`,
    headers: {
      isToken: false,
    },
    method: "PUT",
    data: data,
  });
}

// 删除违规
export function delViolation(data) {
  return request({
    url: `/queue/violation-info-mgr/delete?id=${data}`,
    headers: {
      isToken: false,
    },
    method: "DELETE",
    data: data,
  });
}

// 获取客户精简列表
export function getCustList(data) {
  return request({
    url: "/queue/cust-mgr/get-simple-list",
    headers: {
      isToken: true,
    },
    method: "GET",
    data: data,
  });
}

// 获取排号流程状态列表
export function getLineupStatus(params) {
  return request({
    url: "/queue/tenant-config/get-lineup-status-config",
    headers: {
      isToken: false,
    },
    method: "GET",
    params,
  });
}

// 获取运单流程状态列表
export function getWaybillStatus(data) {
  return request({
    url: "/queue/tenant-config/get-waybill-status-config",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}

// 检查是否绑定微信
export function getBindWxStatus(data) {
  return request({
    url: "/system/bindwx/bind-exist",
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}

//解绑微信
export function getUnbindWx(data) {
  return request({
    url: "/system/bindwx/unbind-wxuser",
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}

//绑定微信
export function getBindWx(data) {
  return request({
    url: `/system/bindwx/bind-wxuser?openId=${data}`,
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}

// 使用用户名，获得租户编号
export function getTernantIdByUserName(data) {
  return request({
    url: `/system/tenant/get-id-by-username?userName=${data}`,
    method: "GET",
  });
}

// 使用用户openId，获得租户编号

export function getTernantIdByOpenId(data) {
  return request({
    url: `/system/tenant/get-id-by-openid?openId=${data}`,
    headers: {
      isToken: false,
    },
    method: "GET",
  });
}
// 获得煤种
export function getCoalLists(data) {
  return requestFy({
    url: `/PurchaseCoalProduct/find-proName/` + data,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 取消运单
export function cancelWaybill(datas) {
  return request({
    url: "/queue/waybill/cancellation-applet",
    method: "PUT",
    data: datas,
  });
}
// 确认收货
export function confirmReceipt(data) {
  return request({
    url: `/queue/waybill/confirm-receipt`,
    // url: `/purchase-confirm/confirm-receipt`,
    method: "POST",
    data: data,
  });
}
//获得字典数据
export function getDictDatas() {
  return request({
    url: `/system/dict-data/list-all-simple`,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 运单挂起
export function confirmSuspendFun(data) {
  return request({
    url: `/queue/waybill/suspendWaybill`,
    headers: {
      isToken: true,
    },
    method: "PUT",
    data: data,
  });
}
// 运单获取挂起信息
export function getSuspendInfoFun(data) {
  return request({
    url: `/queue/waybill/getSuspendInfo`,
    headers: {
      isToken: false,
    },
    method: "GET",
    data: data,
  });
}
// 运单挂起恢复
export function confirmRecoveryFun(data) {
  return request({
    url: `/queue/waybill/resumeWaybill`,
    headers: {
      isToken: true,
    },
    method: "PUT",
    data: data,
  });
}
//查询当前用户的按钮权限数据
export function getButtonShowApi(data) {
  return requestFy({
    url: `/user-autor/get-permission-info-from-applet`,
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}
//查询当前用户的按钮权限数据
export function getTenantConfig() {
  return request({
    url: `/queue/tenant-config/get`,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 运单详情
export function getWayBillDetails(id) {
  return requestFy({
    url:
      "/purchase-coal-send-car/show-orderDetails-from-consolidation?id=" + id,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
